package com.csdn.server;

import com.csdn.actuator.Actuator;
import com.csdn.actuator.EConfig;
import com.csdn.actuator.HttpConfig;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ContainerServlet extends HttpServlet {

    private final Actuator<HttpConfig> actuator;

    public ContainerServlet(Actuator<HttpConfig> actuator) {
        this.actuator = actuator;
    }

    public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        EConfig<HttpConfig> httpConfigEConfig = new EConfig<>();
        HttpConfig config = new HttpConfig(req, resp);
        httpConfigEConfig.setConfig(config);
        System.out.println("执行次数88");
        actuator.execute(httpConfigEConfig);
    }
}
